import VueRouter from 'vue-router';
import Home from "@/components/Home/Home";
import Index from "@/components/Home/Index";
import ModuleConf from "@/components/ModuleConfiguration/ModuleConf";
import Login from "@/components/Login";

const router = new VueRouter({
	routes: [
		// {
		// 	path: "/",  // 默认路由
		// 	redirect: "/Home/Index"
		// },
		{
			path: "/",
			name: "Login",
			component: Login,
			meta: {
				title: "登录"
			},
		},
		{
			path: "/Home/Index",
			name: "Home",
			component: Home,
			meta: {
				title: "首页"
			},
			children: [
				{
					path: "/Home/Index",
					name: "Index",
					component: Index,
					meta: {
						title: "首页"
					}
				},
				{
					path: "/ModuleConfiguration/ModuleConf",
					name: "ModuleConfiguration",
					component: ModuleConf,
					meta: {
						title: "模块配置"
					}
				}
			]
		},
	],
});

// 全局后置钩子
router.afterEach(to => {
	// 设置title
	document.title = to.meta.title;
})

export default router;
